#ifndef MINI_2440_CLIENT_H
#define MINI_2440_CLIENT_H

#include <QtGui>
#include <QTimer>
#include <QStringRef>
#include <QtNetwork>

#include "pictureflow.h"
#include "slideshow.h"
#include "mini2440application.h"
#include "messagescreensave.h"
#include "mini2440ChangePassForm.h"
#include "mini2440InboxForm.h"
#include "mini2440SettingForm.h"
#include "mini2440Configuration.h"

enum FORMINDEX
{
    //CONTACT = 0,
    INBOX = 0,
    SETUP,
    CHANGEPASS,
    QUIT,
};

class Mini2440Client : public QStackedWidget
{
    Q_OBJECT

public:
    Mini2440Client(QStringList* args);
    ~Mini2440Client();

public slots:
    void launchApplication(int index);
    void switchToLauncher();
    void resetInputTimeout();
    void inputTimedout();
    void demoFinished();


    void recievedReadNewMessageSignal();
    void recievedNewMessageSignal();

    void recievedData();

    void recievedWrogpassSignal();

    void displayError(QAbstractSocket::SocketError socketError);
    void onDisconnect();

    void save();
protected:
    void changeEvent(QEvent *event);

private:
    mini2440Configuration* m_config;
    PictureFlow*        pictureFlowWidget;
    ScreenSave*         screenSaveWidget;
    MessageScreenSave*  messageSlideShowWidget;
    mini2440InboxForm*      mInbox;
    mini2440ChangePassForm* mChangePass;
    mini2440SettingForm*    mSetting;
    //mini2440Configuration* mConfig;
    QTimer*             inputTimer;
    QList<QWidget*>     appList;
    quint16             usInboxIndex;
    QTcpSocket          *tcpSocket;
    int                 currentIndex;
    QString             m_ipAdress;
    unsigned int        m_port;


    void initDefaultValue();
    void initConfiguration(QStringList* args);
    void initComponent();
    void initConnection();
    void initSocket();
    void populatePictureFlow();
    void switchToSlideshow();




};


#endif
